
<style type="text/css">
<!--
.style12 {
	font-family: Arial;
	font-size: 10px;
}
-->
</style>
<table width="100%" height = "22"  border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFBF0">
<%
int dLoop=0;
ResultSet Rs = task.fetchContractList();
int R_id = 0;
String Colour="";
float pending = 0;
float unfixed = 0;
while (Rs.next())
{
		R_id = Rs.getInt("id");
		pending = Rs.getFloat("Tons")-Rs.getFloat("receive_tons");
		unfixed = Rs.getFloat("unfixed_tons");
		if ((pending > 0) && (unfixed > 0)) Colour = "#FF0000";
		if ((pending == 0) && (unfixed > 0)) Colour = "#FFFF66";
		if ((pending > 0) && (unfixed == 0)) Colour = "#33CCFF";
		if ((pending == 0) && (unfixed == 0)) Colour = "#000011";
%>
        <tr id=<%=R_id%>  onDblClick="cardViewClick(this);" onClick="highlightOn(this);">
          <td width="2%" height="20" align="center" class="style11" ><%=Rs.getInt("id")%></td>
          <td width="8%" align="center" class="style11" style="color:<%=Colour%>"><%=Rs.getString("ref_number")%></td>
          <td width="8%" class="style11" style="color:<%=Colour%>" align="center"><%=Rs.getString("contract_no")%></td>		  
          <td width="9%" class="style11" align="left" ><%=task.getFieldValueForId("origin_master","name",Rs.getInt("origin_id"))%></td>
          <td width="15%" class="style11" align="left" ><%=task.getFieldValueForId("grade_master","name",Rs.getInt("grade_id"))%></td>
          <td width="12%" class="style11" align="left" ><%=task.getFieldValueForId("company_master","name",Rs.getInt("supplier_buyer_id"))%></td>
          <td width="8%" class="style11" align="center" ><%=Utils.dateToStr(Rs.getDate("first_date"))%></td>
          <td width="8%" class="style11" align="center" ><%=Utils.dateToStr(Rs.getDate("last_date"))%></td>
          <td width="6%" class="style11" align="right" ><%=Utils.numberToStr(Rs.getFloat("tons"),3)%></td>
		  <%
		  if (Rs.getString("type").compareTo("P")==0) 
		  {
		  	pur_ton=pur_ton + Rs.getFloat("tons");
			pur_delvd=pur_delvd + Rs.getFloat("receive_tons");
			pur_pend=pur_pend + (Rs.getFloat("Tons")-Rs.getFloat("receive_tons"));
		  }
		  if (Rs.getString("type").compareTo("S")==0) 
		  {
		  	sal_ton=sal_ton + Rs.getFloat("tons");
			sal_delvd=sal_delvd + Rs.getFloat("receive_tons");
			sal_pend=sal_pend + (Rs.getFloat("Tons")-Rs.getFloat("receive_tons"));
		  }
		  
		  %>
          <td width="6%" class="style11" align="right" ><%=Utils.numberToStr(Rs.getFloat("receive_tons"),3)%></td>		  
          <td width="5%" class="style11" align="right" ><%=Utils.numberToStr(Rs.getFloat("Tons")-Rs.getFloat("receive_tons"),3)%></td>
          <td width="7%" class="style11" align="right" ><%=Utils.numberToStr(Rs.getFloat("basis_outright"),2)%></td>		  
          <td width="6%" class="style11" align="right"><%=Utils.numberToStr(Rs.getFloat("basis_diff"),2)%></td>
        </tr>
<%
		dLoop=dLoop+1;
}
%>
</table>
